"""
将文本文件code.txt中以#开头的注释行删掉
并将结果保存在新的文本文件new.txt中
"""
newfile=open("new.txt",'w',encoding="UTF-8")
with open("code.txt",'r',encoding="UTF-8") as file:
    for line in file:
        for word in line:
            if word=='#':
                break
            newfile.write(word)
newfile.flush()